import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css';
import api from './plugin/axios/index'
import VueQuillEditor from 'vue-quill-editor'
import echarts from 'echarts'
import { JSEncrypt } from 'jsencrypt'
import 'viewerjs/dist/viewer.css'
import Viewer from 'v-viewer'
  Vue.use(Viewer)
  Viewer.setDefaults({
    zIndex: 9999
  })
Vue.prototype.$echarts = echarts 
Vue.prototype.IP = 'https://testyx.0578homestay.com/yx/yx/api/v1/resource/upload' 
Vue.prototype.ewm = 'https://testyx.0578homestay.com/yx'
// JSEncrypt加密方法
Vue.prototype.$getCode = function(password,api){
  // new一个对象
  let encrypt = new JSEncrypt()
  encrypt.setPublicKey(api)
  let data = encrypt.encrypt(password)
  let dataone = encrypt.encrypt(password)
  return data,dataone
}
Vue.use(VueQuillEditor)
Vue.use(api)
Vue.use(ElementUI)
Vue.config.productionTip = false
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')

// router.beforeEach((to,from,next)=>{
//   let token = sessionStorage.getItem('token')
//   if (to.name !== 'logo') {
//     // if (!token) {
//     //   router.push({name: 'logo'})
//     //   alert('1')
//     // }
//   }
// })